#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<assert.h>
#include<io.h>
#include<List.h>
#include<MyFunctions.h>

int main(void)
{
    //All of the variiables---------------------------------------------------------------
    char *tab="C:/Users/Andrey/Desktop/table.csv";
    char *source="C:/Users/Andrey/Desktop/MIPT/IT/Class/Programs/Homeworks/List/text.txt";
    FILE *table = fopen(tab,"w");                                                         //File to write the results to
    FILE *Text = fopen(source,"r");                                                       //File to read the info from
    char line[30];                                                                        //a word to sort                                                                     //counter
    int option = 0;
    int counter = 0;
    //------------------------------------------------------------------------------------
    //Body_and_commands:
    Checking_File(table,tab);                                                             //Checking files
    Checking_File(Text, source);

    option=Interface();                                                                   //Interacting with the user

    Filling_The_array_of_keys();                                                          //Creating the array of numbers from 1 to 256
    //Reading the text from a file
    while (!feof(Text))
    {
        fscanf(Text,"%s",line);
        List_Insert(line, option);
    }
    for(counter = 0; counter < Num_of_hash; counter++)
    {
        if (Array_Of_Keys[counter].num_of_elem>0)
        fprintf(table,"%d \n",Array_Of_Keys[counter].num_of_elem);
    }

    fclose(table);
    fclose(Text);
    printf("Successfully sorted! \a \n");
    return 0;
}

